use East2West
go
-- Store Procedure List 
create proc sp_ListAllPackageType
as
	select * from PackageType
go

create proc sp_ListAllCarModel
as
	select * from CarModel
go

-- Store Procedure Login
create proc sp_LoginCustomer
	@username nvarchar(50),
	@password nvarchar(50)
as
	select * from Customer where UserName = @username and Password = @password
go

create proc sp_LoginAdmin 
	@username nvarchar(50),
	@password nvarchar(50)
as
	select * from Admin where UserName = @username and Password = @password
go

-- Store Procedure Register
create proc sp_Register 
	@username nvarchar(50),
	@password nvarchar(50),
	@customername nvarchar(200),
	@email nvarchar(200),
	@phonenumber nvarchar(200),
	@address nvarchar(max)
as
	insert into Customer values (@username,@password,@customername,@email,@phonenumber,@address)
go

-- Store Procedure Feedback
create proc sp_Feedback
	@cusID int,
	@title nvarchar(200),
	@content nvarchar(max)
as
	insert into FeedBack values (@cusID,@title,@content)
go

-- Store Procedure Management PackageType
create proc sp_NewPackageType 
	@name nvarchar(200),
	@description nvarchar(max)
as
	insert into PackageType values (@name,@description)
go

create proc sp_UpdatePackageType 
	@packageTypeID int,
	@name nvarchar(200),
	@description nvarchar(max)
as
	update PackageType set PackageName = @name , Description = @description
	where PackageTypeID = @packageTypeID 
go

-- Store Procedure Management Location
create proc sp_NewLocation
	@name nvarchar(200),
	@description nvarchar(max)
as
	insert into Locations values (@name,@description)

go

create proc sp_UpdateLocation
	@locationID int,
	@name nvarchar(200),
	@description nvarchar(max)
as
	update Locations set LocationName = @name , Description = @description
	where LocationID = @locationID 
go

--Store Procedure Management Places
create proc sp_NewPlace 
	@locationID int,
	@name nvarchar(200),
	@description nvarchar(max)
as
	insert into Places values (@locationID, @name, @description)
go 

create proc sp_UpdatePlace
	@placeID int,
	@locationID int,
	@name nvarchar(200),
	@description nvarchar(max)
as
	update Places set LocationID = @locationID, PlaceName = @name, Description = @description 
	where PlaceID = @placeID 
go

--Store Procedure Management Hotels
create proc sp_NewHotel
	@placeID int,
	@name nvarchar(200),
	@rate int,
	@price money
as
	insert into Hotels values (@placeID,@name,@rate,@price)
go 

create proc sp_UpdateHotel
	@hotelID int,
	@placeID int,
	@name nvarchar(200),
	@rate int,
	@price money
as
	update Hotels set PlaceID = @placeID , HotelName = @name , HotelRate = @rate , HotelPrice = @price
	where HotelID = @hotelID
go

--Store Procedure Management Foods
--Store Procedure Management CarModel
create proc sp_NewCarModel
	@name nvarchar(200),
	@description nvarchar(max)
as
	insert into CarModel values (@name,@description)
go

create proc sp_UpdateCarModel
	@name nvarchar(200),
	@description nvarchar(max)
as
	update CarModel set ModelName = @name, Description = @description
	
